<!DOCTYPE html>
<head>
	<meta charset="UTF-8">
	<title></title>

	<body>
		<font>在controller类头部添加@CrossOrigin(origins = "*", maxAge = 3600)以支持跨域</font><br />
		<input type="button" value="请求" onclick="loadImg()" />
		<div id="databox"></div>
	</body>

	<script src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
	<script type="text/javascript">
		function loadImg() {
			console.log("-----------华丽的分界线------------")
			$.ajax({
				dataType: "json",
				url:"http://localhost:8080/test/" +
				"queryProducts.do",
				type: "POST",
				success: function(data) {
					showcode(data);

				}
			});
		}
		
		
		function showcode(data){
			var str = '<div>';
			str+="<font>-----------华丽的分界线------------</font><br/>";
			console.log(data)
			str +='<font>数据在控制台汇中</font><br/>';
			str += "</div>";
			$("#databox").append(str);
			
		}
		
		

	</script>

	</html>